import BaseMonsterSkill from "./BaseMonsterSkill";
import IBaseMonsterSkill from "./IBaseMonsterSkill";
import MonsterScript from "../../../component/MonsterScript";
import EffectUtil from "../../../utils/EffectUtil";
import Game from "../../Game";





export default class BlockSkill extends BaseMonsterSkill implements IBaseMonsterSkill {

    _pr: number;

    init(target: MonsterScript, skillId) {
        super.init(target, skillId);
        this._pr = this._skillData.pr ? this._skillData.pr : 0.5;
        this._target.addHitCb(this.hitCb.bind(this))
    }


    hitCb() {
        if (Math.random() > this._pr) {
            return false;
        }
        EffectUtil.playTextEffect(Game.flyLayer, "格挡", { x: this._target.hpBar.x, y: this._target.hpBar.y },20);
        return true;

    }


    exec() {
    

    }


}